#ifndef OBJECT_H_INCLUDED
#define OBJECT_H_INCLUDED
#include "common.h"
#include "triangle.h"
#include "clstate.h"

struct object
{

    triangle *triangles;

    cl_float4 *texture;

    //cl_uint *blank;

    unsigned int gid;

    static unsigned int cgid;

    cl_mem gmem;
    cl_mem gtex;

    cl_mem gisdrawbuffer;

    int tex_width;
    int tex_height;

    bool is_textured;
    bool is_tex_loaded;


    v3d rotation;

    v3d position;

    bool is_gmem;

    int allocated;  ///am i allocated
    unsigned int max_tnum;   ///max number of triangles

    int base;

    unsigned int curtriangle; ///should be equal to max_tnum

    std::string texname;


    object();


    void allocate_triangles(int num);

    void add_triangle(triangle &t);

    void add_triangle(vertex points[3]);


    void push(); ///obsolete

    void rem(); ///obsolete


    triangle &get_triangle(int num);


    void gmem_push(); ///obsolete

    void gmem_del(); ///obsolete


    void texture_load();

    void texture_load(sf::Image &img);

    void texture_load(cl_float4*, int, int);

    void gtex_push(); ///obsolete

    void gtex_del(); ///obsolete


    void gid_take();



};



#endif // OBJECT_H_INCLUDED
